package list

func buildList(arr []int) *ListNode {
	var pre *ListNode
	for i := len(arr) - 1; i >= 0; i-- {
		node := &ListNode{
			Val:  arr[i],
			Next: pre,
		}
		pre = node
	}
	return pre
}
